/**
 * 抖音关注：程序员三丙
 * 知识星球：https://t.zsxq.com/j9b21
 */
package sanbing.example.dylike.application.rpc;

import com.fasterxml.jackson.databind.JsonNode;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.SneakyThrows;
import sanbing.example.dylike.util.JacksonUtil;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class RpcRequest {

    private RpcMethod method;
    private JsonNode params;

    @SneakyThrows
    public byte[] toBytes() {
        return JacksonUtil.OBJECT_MAPPER.writeValueAsBytes(this);
    }
}